package com.libinyn.base.i18n.config.i18n;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;

/**
 * @fileName: MyLocaleResolver.java
 * @author: bin.li01
 * @date: 2017/12/20 23:29 
 * @version: v1.0.0
 */
public class MyLocaleResolver extends AcceptHeaderLocaleResolver{
    
    private Locale myLocal;
    
    @Override
    public Locale resolveLocale(HttpServletRequest request) {
        return myLocal==null?request.getLocale():myLocal;
    }

    @Override
    public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) {
        myLocal = locale;
    }
}
